﻿@model Ornament.MemberShip.UserGroup
@{
    
    ViewBag.Title = this.Model.Name + "分配用户";
    Layout = "~/Views/Shared/App.cshtml";
    <script src="@Url.Content("~/Scripts/lib/jquery.doubleSelectBox.js")" type="text/javascript"></script>
    Html.BeginForm();
    <input type="hidden" name="Id" value="@Model.Id" />
    <button type="submit">
        @Resources.Basic.Save</button>
    <button type="button" id="cancel">
        @Resources.Basic.Cancel
    </button>
    <table id="table">
        <tr>
            <td style="vertical-align: middle; border-width: 0px">
                @{this.Html.RenderPartial("../User/UserSearcher");}
            </td>
            <td style="vertical-align: middle; border-width: 0px">
                <div>
                    <input id="aToB" type="button" value=" > " />
                </div>
                <div>
                    <input id="bToA" type="button" value=" < " />
                </div>
            </td>
            <td style="vertical-align: middle; border-width: 0px">
                <select name="loginIds" multiple="multiple" id="loginIds" style="width: 200px; height: 250px"
                    class="ui-widget ui-widget-content">
                    @foreach (var user in (IList<Ornament.MemberShip.User>)ViewData["Users"])
                    {
                        <option value="@user.LoginId">@user.Name</option>
                    }
                </select>
            </td>
        </tr>
    </table>
    Html.EndForm();

}
@section PageTitle{
    分配用户:@Model.Name
}
@section Header{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#aToB,#bToA,button").button();
            $("#cancel").click(function () {
                location = '@Url.Action("index")';
            });
            $("form").submit(function () {
                $("#loginIds").children().each(function () {
                    this.selected = true;
                });
            });

            $("#table").doubleSelectBox({
                aToB: { target: $("#aToB"), event: 'click' },
                bToA: { target: $("#bToA"), event: 'click' }
            });
        });
    </script>
}
